/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.settlement.entity.investorsettlement;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.base.entity.supplier.Supplier;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.util.List;

/**
 * 资方结算单Entity
 * @author Kilo
 * @version 2021-03-10
 */
@Table(name="t_investor_settlement", alias="a", columns={
		@Column(name="investor_settlement_id", attrName="investorSettlementId", label="资方结算单ID", isPK=true),
		@Column(name="investor_settlement_code", attrName="investorSettlementCode", label="编号"),
		@Column(name="investor_id", attrName="investorId", label="资方"),
		@Column(name="service_order_id", attrName="serviceOrderId", label="服务订单"),
		@Column(name="date", attrName="date", label="结算日期"),
		@Column(name="letter_credit_code", attrName="letterCreditCode", label="信用证"),
		@Column(name="year_car_sale_purchase_agreement_code", attrName="yearCarSalePurchaseAgreementCode", label="年度汽车买卖协议"),
		@Column(name="payment_method", attrName="paymentMethod", label="付款方式"),
		@Column(name="prepayment_balance", attrName="prepaymentBalance", label="预付款余额", isQuery=false),
		@Column(name="financial_review_flag", attrName="financialReviewFlag", label="是否财务复核"),
		@Column(name="investor_prepayment_balance", attrName="investorPrepaymentBalance", label="预付资方余额", isQuery=false),
		@Column(name="remarks", attrName="remarks", label="备注信息", isQuery=false),
		@Column(name="financial_review_memo", attrName="financialReviewMemo", label="财务复核", isQuery=false),
		@Column(name="create_by", attrName="createBy", label="创建者", isUpdate=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false),
		@Column(name="update_by", attrName="updateBy", label="更新者", isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false),
	}, joinTable={
		@JoinTable(type=Type.LEFT_JOIN, entity= Supplier.class, attrName="investor", alias="e",
				on="e.supplier_id = a.investor_id", columns={
				@Column(name="supplier_id", label="资方编码", isPK=true),
				@Column(name="supplier_name", label="资方名称", isQuery=true),
		}),
	},orderBy="a.update_date DESC"
)
public class InvestorSettlement extends DataEntity<InvestorSettlement> {

	private static final long serialVersionUID = 1L;
	private String investorSettlementId;		// 资方结算单ID
	private String investorSettlementCode;		// 编号
	private String investorId;		// 资方
	private String serviceOrderId;		// 服务订单
	private Date date;		// 结算日期
	private String letterCreditCode;		// 信用证
	private String yearCarSalePurchaseAgreementCode;		// 年度汽车买卖协议
	private String paymentMethod;		// 付款方式
	private Double prepaymentBalance;		// 预付款余额
	private String financialReviewFlag;		// 是否财务复核
	private Double investorPrepaymentBalance;		// 预付资方余额
	private String financialReviewMemo;		// 财务复核
	private List<InvestorSettlementPayment> investorSettlementPaymentList = ListUtils.newArrayList();		// 子表列表
	private List<InvestorSettlementPrepayment> investorSettlementPrepaymentList = ListUtils.newArrayList();		// 子表列表
	private List<InvestorSettlementDetail> investorSettlementDetailList = ListUtils.newArrayList();		// 子表列表
	private Supplier investor;

	private String serviceOrderCode;

	private String investorName;

	public Supplier getInvestor() {
		return investor;
	}

	public void setInvestor(Supplier investor) {
		this.investor = investor;
	}

	public InvestorSettlement() {
		this(null);
	}

	public InvestorSettlement(String id){
		super(id);
	}

	public String getInvestorSettlementId() {
		return investorSettlementId;
	}

	public void setInvestorSettlementId(String investorSettlementId) {
		this.investorSettlementId = investorSettlementId;
	}

	@Length(min=0, max=100, message="编号长度不能超过 100 个字符")
	public String getInvestorSettlementCode() {
		return investorSettlementCode;
	}

	public void setInvestorSettlementCode(String investorSettlementCode) {
		this.investorSettlementCode = investorSettlementCode;
	}

	@NotBlank(message="资方不能为空")
	@Length(min=0, max=64, message="资方长度不能超过 64 个字符")
	public String getInvestorId() {
		return investorId;
	}

	public void setInvestorId(String investorId) {
		this.investorId = investorId;
	}

	@Length(min=0, max=64, message="服务订单长度不能超过 64 个字符")
	public String getServiceOrderId() {
		return serviceOrderId;
	}

	public void setServiceOrderId(String serviceOrderId) {
		this.serviceOrderId = serviceOrderId;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@Length(min=0, max=100, message="信用证长度不能超过 100 个字符")
	public String getLetterCreditCode() {
		return letterCreditCode;
	}

	public void setLetterCreditCode(String letterCreditCode) {
		this.letterCreditCode = letterCreditCode;
	}

	@Length(min=0, max=100, message="年度汽车买卖协议长度不能超过 100 个字符")
	public String getYearCarSalePurchaseAgreementCode() {
		return yearCarSalePurchaseAgreementCode;
	}

	public void setYearCarSalePurchaseAgreementCode(String yearCarSalePurchaseAgreementCode) {
		this.yearCarSalePurchaseAgreementCode = yearCarSalePurchaseAgreementCode;
	}

	@Length(min=0, max=2, message="付款方式长度不能超过 2 个字符")
	public String getPaymentMethod() {
		return paymentMethod;
	}

	public void setPaymentMethod(String paymentMethod) {
		this.paymentMethod = paymentMethod;
	}

	public Double getPrepaymentBalance() {
		return prepaymentBalance;
	}

	public void setPrepaymentBalance(Double prepaymentBalance) {
		this.prepaymentBalance = prepaymentBalance;
	}

	@Length(min=0, max=1, message="是否财务复核长度不能超过 1 个字符")
	public String getFinancialReviewFlag() {
		return financialReviewFlag;
	}

	public void setFinancialReviewFlag(String financialReviewFlag) {
		this.financialReviewFlag = financialReviewFlag;
	}

	public Double getInvestorPrepaymentBalance() {
		return investorPrepaymentBalance;
	}

	public void setInvestorPrepaymentBalance(Double investorPrepaymentBalance) {
		this.investorPrepaymentBalance = investorPrepaymentBalance;
	}

	@Length(min=0, max=255, message="财务复核长度不能超过 255 个字符")
	public String getFinancialReviewMemo() {
		return financialReviewMemo;
	}

	public void setFinancialReviewMemo(String financialReviewMemo) {
		this.financialReviewMemo = financialReviewMemo;
	}

	public Date getDate_gte() {
		return sqlMap.getWhere().getValue("date", QueryType.GTE);
	}

	public void setDate_gte(Date date) {
		sqlMap.getWhere().and("date", QueryType.GTE, date);
	}

	public Date getDate_lte() {
		return sqlMap.getWhere().getValue("date", QueryType.LTE);
	}

	public void setDate_lte(Date date) {
		sqlMap.getWhere().and("date", QueryType.LTE, date);
	}

	public Date getCreateDate_gte() {
		return sqlMap.getWhere().getValue("create_date", QueryType.GTE);
	}

	public void setCreateDate_gte(Date createDate) {
		sqlMap.getWhere().and("create_date", QueryType.GTE, createDate);
	}

	public Date getCreateDate_lte() {
		return sqlMap.getWhere().getValue("create_date", QueryType.LTE);
	}

	public void setCreateDate_lte(Date createDate) {
		sqlMap.getWhere().and("create_date", QueryType.LTE, createDate);
	}

	public List<InvestorSettlementPayment> getInvestorSettlementPaymentList() {
		return investorSettlementPaymentList;
	}

	public void setInvestorSettlementPaymentList(List<InvestorSettlementPayment> investorSettlementPaymentList) {
		this.investorSettlementPaymentList = investorSettlementPaymentList;
	}

	public List<InvestorSettlementPrepayment> getInvestorSettlementPrepaymentList() {
		return investorSettlementPrepaymentList;
	}

	public void setInvestorSettlementPrepaymentList(List<InvestorSettlementPrepayment> investorSettlementPrepaymentList) {
		this.investorSettlementPrepaymentList = investorSettlementPrepaymentList;
	}

	public List<InvestorSettlementDetail> getInvestorSettlementDetailList() {
		return investorSettlementDetailList;
	}

	public void setInvestorSettlementDetailList(List<InvestorSettlementDetail> investorSettlementDetailList) {
		this.investorSettlementDetailList = investorSettlementDetailList;
	}

	public String getServiceOrderCode() {
		return serviceOrderCode;
	}

	public void setServiceOrderCode(String serviceOrderCode) {
		this.serviceOrderCode = serviceOrderCode;
	}

	public String getInvestorName() {
		return investorName;
	}

	public void setInvestorName(String investorName) {
		this.investorName = investorName;
	}
}
